@echo off
chcp 65001 >nul
echo ====================================
echo 检查本地数据库表和存储过程
echo ====================================
echo.
echo 请输入MySQL的root密码：
echo.

mysql -u root -p -e "USE math_academy; SELECT '=== 检查表结构 ===' as title; SHOW TABLES; SELECT '=== 检查错题本表 ===' as check_result; SELECT COUNT(*) as mistake_book_exists FROM information_schema.tables WHERE table_schema='math_academy' AND table_name='mistake_book'; SELECT '=== 检查成就表 ===' as check_result; SELECT COUNT(*) as achievements_exists FROM information_schema.tables WHERE table_schema='math_academy' AND table_name='achievements'; SELECT '=== 检查存储过程 ===' as check_result; SHOW PROCEDURE STATUS WHERE db='math_academy';"

echo.
echo ====================================
echo 检查完成
echo ====================================
echo.
echo 如果看到 mistake_book_exists 和 achievements_exists 都是 1，
echo 并且有 check_and_unlock_achievements 存储过程，说明数据库正常。
echo.
echo 如果缺少表或存储过程，请运行：本地补充数据库表.bat
echo.
pause

